package com.caiyi.financial.nirvana.sms.controller;

import com.caiyi.financial.nirvana.sms.entity.SmsGatewaySign;
import com.caiyi.financial.nirvana.sms.querybean.GatewaySignQueryBean;
import com.caiyi.financial.nirvana.sms.service.SmsGatewaySignService;
import com.youyu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "通道标签管理")
@RestController
@RequestMapping("sms/admin/gatewaySign")
public class GatewaySignController {

    @Autowired
    private SmsGatewaySignService gatewaySignService;

    @ApiOperation(value = "添加GatewaySign详情", notes = "添加GatewaySign详情描述")
    @ApiImplicitParam(name = "smsGatewaySign", value = "通道标签", required = true, dataType = "SmsGatewaySign")
    @PostMapping("/addGatewaySign")
    public Result addGatewaySign(@RequestBody SmsGatewaySign smsGatewaySign) {
        return Result.ok(gatewaySignService.addGatewaySign(smsGatewaySign));
    }

    @ApiOperation(value = "删除GatewaySign详情", notes = "删除GatewaySign")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "通道标签id", dataType = "int", paramType = "query", required = true)})
    @PostMapping("/deleteGatewaySign")
    public Result deleteGatewaySign(Integer id) {
        return Result.ok(gatewaySignService.deleteGatewaySign(id));
    }

    @ApiOperation(value = "更新GatewaySign详情", notes = "更新GatewaySign")
    @ApiImplicitParam(name = "smsGatewaySign", value = "通道标签", required = true, dataType = "SmsGatewaySign")
    @PostMapping("/updateGatewaySign")
    public Result updateGatewaySign(@RequestBody SmsGatewaySign smsGatewaySign) {
        return Result.ok(gatewaySignService.updateGatewaySign(smsGatewaySign));
    }


    @ApiOperation(value = "根据params查找GatewaySign详情", notes = "根据params查找GatewaySign详情描述")
    @ApiImplicitParams({@ApiImplicitParam(name = "bean", value = "查找通道标签参数", dataType = "GatewaySignQueryBean", paramType = "GatewaySignQueryBean"),

    })
    @PostMapping("/getGatewaySignByParams")
    public Result getGatewaySignByParams(@RequestBody GatewaySignQueryBean bean) {
        return Result.ok(gatewaySignService.getGatewaySignByParams(bean));
    }

    @ApiOperation(value = "修改通道签名状态详情", notes = "修改通道签名状态详情描述")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "通道签名id", required = true, dataType = "int", paramType = "query")
    })
    @PostMapping("/changeStatus")
    public Result changeStatus(Integer id) {
        return Result.ok(gatewaySignService.updateStatus(id));
    }
}
